﻿<UserControl x:Class="Chapters.Chapter12.FromToAnimation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<UserControl.Resources>
		<Storyboard x:Key="FromToColorAnimation">
			<ColorAnimation From="Violet"
											To="Red"
											Duration="0:0:3"
											Storyboard.TargetName="FromToEllipse"
											Storyboard.TargetProperty="Fill.(SolidColorBrush.Color)" />
		</Storyboard>

	</UserControl.Resources>
	<DockPanel>
		<StackPanel Orientation="Horizontal"
								DockPanel.Dock="Top"
								HorizontalAlignment="Right">
			<Button x:Name="_fromToPlay">Play Animation</Button>
		</StackPanel>
		<Ellipse x:Name="FromToEllipse"
						 Fill="LightGray"
						 Stroke="Gray" />
	</DockPanel>
	<UserControl.Triggers>
		<EventTrigger RoutedEvent="Button.Click"
									SourceName="_fromToPlay">
			<BeginStoryboard Storyboard="{StaticResource FromToColorAnimation}" />
		</EventTrigger>
	</UserControl.Triggers>
</UserControl>
